<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"> 

<h:head>CreatedEventsPage</h:head> 
<body> 

	

	<h:form>
	<!-- User's options from this page -->
		<p:menubar>
			
			<p:submenu label="Invite Management">
			 	<p:menuitem value="See invites received" action="invitesReceivedPage"/>
 			</p:submenu>
 			
			<p:menuitem value="Calendar Page" action="calendarPage"/>
 			<p:menuitem value="Logout #{userBean.name}" action="#{loginBean.logout()}"/>
		</p:menubar>
      
     </h:form>
     
<!-- Contains the list of events created by the logged user. -->
	<p:dataList value="#{eventsCreatedBean.eventsCreated}" var="event" type="ordered">
		 <h:form>
        	<h:outputText value="#{event.name}" /> <br/>
        	<h:outputText value="#{event.datetimebegin}" /> <br/>
			<h:outputText value="#{event.place}" /> <br/>
			<h:outputText value="#{event.description}" /> <br/>
			<h:outputText value="#{event.weather.condition}"/><br/>
        	<h:outputText value="#{event.weather.temperature}"/><br/>
        	
        	<!-- Allows to select an event and to be redirected to its modification page. -->
            <p:commandButton value="Modify #{event.name}" action="#{eventsCreatedBean.eventModificationPage}" actionListener="#{eventsCreatedBean.setEventChoose}" >
                <f:attribute name="event" value="#{event}" />
            </p:commandButton>
        </h:form>
        <br/>
	</p:dataList>
	
</body> 
</html>
